import { ResPage, User } from "@/api/interface/index";
import { PORT1, MYPORT1 } from "@/api/config/servicePort";
import http from "@/api";
import md5 from "md5";

/**
 * @name 用户管理模块
 */

// 获取跟单员列表
export const getUserList = params => {
  return http.get(MYPORT1 + `/v1/users`, params);
};
// 修改跟单员信息
export const editUser = params => {
  return http.put(MYPORT1 + `/v1/users/${params.id}`, params);
};
// 删除跟单员
export const deleteUser = params => {
  return http.delete(MYPORT1 + `/v1/users/${params.id}`, {});
};
// 重置跟单员密码
export const resetUserPassword = params => {
  return http.put(MYPORT1 + `/v1/reset_password`, params);
}; // 重置跟单员密码
export const updateUserPassword = params => {
  return http.put(MYPORT1 + `/v1/change_password`, params);
};
// 新增用户
export const addUser = params => {
  params.password_hash = md5("123456");
  params.email = "123456";
  params.user_type = "Agent";
  return http.post(MYPORT1 + `/v1/users`, params);
};
